[FLINK-39687] [sql-gateway] Fix URI dependency conversion in SessionContext#28529
[FLINK-39687] [sql-gateway] Fix URI dependency conversion in SessionContext#28529qiuyanjun888 wants to merge 2 commits into
Conversation
| private static URL toURL(URI uri) { | ||
| try { | ||
| return uri.toURL(); | ||
| } catch (MalformedURLException e) { |
There was a problem hiding this comment.
nit: a plain --jar foo.jar is a schemeless URI, so toURL() throws IllegalArgumentException, not MalformedURLException — dodges this catch. Add it?
| } catch (MalformedURLException e) { | |
| } catch (MalformedURLException | IllegalArgumentException e) { |
There was a problem hiding this comment.
Fixed by catching IllegalArgumentException alongside MalformedURLException and wrapping it in SqlGatewayException; added a regression test for URI.create("foo.jar").
Verification: ./mvnw -pl flink-table/flink-sql-gateway -Dtest=SessionContextTest test -DfailIfNoTests=false passed, and git diff --check passed.
|
This PR is focused on SQL Gateway SessionContext dependency URI conversion. @lincoln-lil @rmetzger @fsk119 could you please take a look when you have time and advise whether this approach is acceptable for this area and can move forward? |
What is the purpose of the change
This pull request fixes
SessionContextcreation when the default SQL Gateway context contains dependency URIs. The previous code passedList<URI>elements totoArray(new URL[0]), which throwsArrayStoreExceptionas soon as the dependency list is non-empty.Brief change log
URIto aURLbefore creating the session user-code classloader.SessionContextTestregression test that creates a session from aDefaultContextwith a non-empty dependency list and verifies the dependency URL is available from the user-code classloader.Verifying this change
This change added tests and can be verified as follows:
./mvnw -pl flink-table/flink-sql-gateway -Dtest=SessionContextTest#testCreateContextWithDependencies -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false -Dfast test./mvnw -pl flink-table/flink-sql-gateway -Dtest=SessionContextTest -Dfast test./mvnw -pl flink-table/flink-sql-gateway spotless:check checkstyle:checkI also verified that the new regression test fails against the previous production implementation with
java.lang.ArrayStoreException: java.net.URI.Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Hermes Agent / OpenAI GPT-5.5